#!/usr/bin/python

import sys
from random import shuffle
from itertools import izip, chain

PERIOD = 3

def pshuffle_ideal(period, seq):
    assert len(seq) % period == 0
    indices = [[seq[i] for i in xrange(j % period, len(seq), period)] for j in xrange(period)]
    for l in indices:
        shuffle(l)
    return ''.join(chain(*izip(*indices)))

def pshuffle(period, seq):
    slength = (len(seq) / period) * period
    return pshuffle_ideal(period, seq[:slength]) + seq[slength:]


def main():
    for line in sys.stdin:
        id, seq = line.split()
        pseq = pshuffle(PERIOD, seq)
        print "%s\t%s" % (id, pseq)

if __name__ == "__main__":
    main()

